#include <bits/stdc++.h>
using namespace std;
int main(){
    int cur = 0, sum = 0;
    int x;
    for (int i = 1; i <= 12; i++){
        cur += 300;
        cin >> x;
        if (cur < x){
            cout << -i << endl;
            return 0;
        }
        cur = cur - x;
        sum += cur / 100 * 100;
        cur = cur % 100;
    }
    cur = cur + sum * 1.2;
    cout << cur;
    return 0;
}